<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>巡检-精工云MES系统移动端</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link href="/JG/Content/jquery/weui/style/weui.min.css" rel="stylesheet" />
    <link href="/JG/Content/jquery/jquery-weui/css/jquery-weui.min.css" rel="stylesheet" />
    <link href="/JG/Content/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/JG/Content/css/Global.css" rel="stylesheet" />
    <link rel="stylesheet" href="/JG/Content/css/MobilePolling.css">
    <link href="/JG/Content/jquery/jquery-weui/css/icon.css" rel="stylesheet" />
    <script src="/JG/Content/LocalConfigs.js?v=1"></script>
    <script src="/JG/Content/LocalUserInfo.js"></script>
    <style>
        [v-cloak] {
            display: none;
        }
    </style>
</head>

<body>
    <header class="header">
        <div class="empty">
            <span id="stations"></span>
        </div>
        <div class="weui-flex">
            <div class="weui-flex__item" style="position:absolute;">
                <span style="font-size:16px" class="icon icon-109 f-white"
                    onclick="javascript:location.href='/JG/Home/MobileIndex.html'">返回</span>
            </div>
            <div class="weui-flex__item" style="text-align: center;">巡检</div>
        </div>
    </header>

    <div id="MainPage" v-cloak>
        <div class="top_modal">
            <ul class=" list-group">
                <li class="list-group-item proline">
                    <div class="weui-cell weui-cell_select ">
                        <div class="weui-cell__hd protitle">
                            <label class="weui-form-preview__label">生产线</label>
                        </div>
                        <div class="weui-cell__bd weui-form-preview__value">
                            <select class="weui-select" name="select2" placeholder="请选择生产产线"
                                v-model="ProductionLineCode" @change="ProductionLineClick(this)">
                                <option disabled selected value>请选择生产产线</option>
                                <option v-for="option in ProductionLineData" :value="option.CXSJ_CXBM">
                                    {{option.CXSJ_CXMC}}
                                </option>
                            </select>
                        </div>
                    </div>
                </li>
                <li class="list-group-item ">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label processleft">订单号码</label>
                        <span class="weui-form-preview__value">{{OrderCode}}</span>
                    </div>
                </li>
                <li class="list-group-item ">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label processleft">任务单号</label>
                        <span class="weui-form-preview__value">{{TaskCode}}</span>
                        <button class="btn btn-success select" @click="GetWorkNumber()">选择</button>
                    </div>
                </li>
                <li class="list-group-item ">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label processleft">产品编号</label>
                        <span class="weui-form-preview__value">{{ProductCode}}</span>
                    </div>
                </li>
                <li class="list-group-item ">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label processleft">产品名称</label>
                        <span class="weui-form-preview__value">{{submitProduct}}</span>
                    </div>
                </li>
                <li class="list-group-item ">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label processleft">产品规格</label>
                        <span class="weui-form-preview__value">{{ProductSize}}</span>
                    </div>
                </li>
                <li class="list-group-item proline">
                    <div class="weui-cell weui-cell_select bor ">
                        <div class="weui-cell__hd protitle">
                            <label class="weui-form-preview__label">生产工序</label>
                        </div>
                        <div class="weui-cell__bd ">
                            <select class="weui-select" name="select2" placeholder="请选择工序" v-model="ProductProcessCode"
                                @change="ProductProcessClick(this)" @click="ProcessItem">
                                <option disabled selected value>请选择工序</option>
                                <option value="" v-for="(item,index) in ProductProcess"
                                    v-bind:value="item.GYLXGX_GXNUM">
                                    {{item.GYLXGX_GXNAME}}
                                </option>
                            </select>
                        </div>
                    </div>
                </li>

            </ul>

            <!--清除浮动-->
            <div class="clean"></div>
        </div>
        <div class="polling_modal">
            <div class="polling_list">
                <div class="polling_title">检测项</div>
                <ul>
                    <li>
                        <ul class="left_list">
                            <li v-for="(item,index) in CheckData" :key="index" @click="changCheck(item)">
                                <span>
                                    <img :src="check(item)?'/JG/Content/images/none.png':'/JG/Content/images/none2.png'"
                                        alt=""></span>
                                <span>{{item.JCXM_JCXMC}}</span>

                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="btns">
                <div class="qualified_btn" @click="toggle1()">
                    <button type="button" class="btn btn-success" v-html="QualifiedBtn">合格</button>
                </div>
                <div class="unqualified_btn" @click="toggle2()">
                    <button type="button" class="btn btn-danger" v-html="UnqualifiedBtn">不合格</button>
                </div>
            </div>
        </div>
        <div class="count_modal">
            <!--清除浮动-->
            <div class="clean"></div>
            <div class="polling_record">
                <div class="record">检测记录</div>
                <div class="PollingTitle" v-for="(item,index) in CheckRecord" :key="index">
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">序号</label>
                        <span class="weui-form-preview__value"> {{++index}}</span>
                    </div>
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">检测编号</label>
                        <span class="weui-form-preview__value"> {{item.CheckCode}}</span>
                    </div>
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">检测名称</label>
                        <span class="weui-form-preview__value"> {{item.CheckName}}</span>
                    </div>
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">是否合格</label>
                        <span class="weui-form-preview__value"> {{item.CheckStatu}}</span>
                    </div>
                    <div class="weui-form-preview__item">
                        <label class="weui-form-preview__label">操作日期</label>
                        <span class="weui-form-preview__value"> {{item.CheckTime}}</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="mod" v-show="show">
            <div class="mod1" v-show="show1">
                <div class="contentText">
                    <span>
                        <span class="poll">实检数量:</span>

                        <input type="tel" placeholder="只能输入数字" @input="change1" @change="change1"
                            :value="QualifiedCheckNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
                    </span>
                    <span>
                        <span class="poll">合格数量:</span>
                        <input type="tel" placeholder="只能输入数字" @input="change2" @change="change2"
                            :value="QualifiedNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></span>
                    <span>
                        <span class="poll">不合格数量:</span>
                        <input type="tel" placeholder="只能输入数字" @input="change4" @change="change4"
                            :value="UnqualifiedNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></span>
                    <span>
                        <span class="poll">备注原因:</span>
                        <textarea cols="20" rows="1" :value="QualifiedremarkNum" @change="change5"
                            style="border: 1px solid #bbb;"></textarea>
                    </span>
                    <div class="but" style="padding-top: 3%;">
                        <button type="button" class="cancel" @click="cancel1">取消</button>
                        <button type="button" class="confirm" @click="confirm1">确认</button>
                    </div>
                </div>
            </div>
            <div class="mod2" v-show="show2">
                <div class="contentText">
                    <span>
                        <span class="poll">实检数量:</span>
                        <input type="tel" placeholder="只能输入数字" @input="change3" @change="change3"
                            :value="UnqualifiedCheckNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></span>
                    <span>
                        <span class="poll">合格数量:</span>
                        <input type="tel" placeholder="只能输入数字" @input="change2" @change="change2"
                            :value="QualifiedNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></span>
                    <span>
                        <span class="poll">不合格数量:</span>
                        <input type="tel" placeholder="只能输入数字" @input="change4" @change="change4"
                            :value="UnqualifiedNum" pattern="[0-9]*"
                            onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
                            onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></span>
                    <span>
                        <span class="poll">备注原因:</span>
                        <textarea cols="20" rows="1" :value="UnqualifiedremarkNum" @change="change6"
                            style="border: 1px solid #bbb;"></textarea>
                    </span>
                    <div class="but" style="padding-top: 3%;">
                        <button type="button" class="cancel" @click="cancel2">取消</button>
                        <button type="button" class="confirm" @click="confirm2">确认</button>
                    </div>
                </div>
            </div>
        </div>
        <!--任务列表弹窗选项部分-->
        <div class="shade " v-show="gdNumber">
            <div class="shade_box">
                <div class="weui-flex workrecord">
                    <div class="weui-flex__item buliang">任务单信息</div>
                </div>
                <div class="info">
                    <div style="height:45px"></div>
                    <div class="recordtable" v-for="item in WorkNumberData">
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">订单号码</label>
                            <span class="weui-form-preview__value"> {{item.SCRW_DDHM}}</span>
                        </div>
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">任务单号</label>
                            <span class="weui-form-preview__value"> {{item.SCRW_RWDH }}</span>
                        </div>
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">产品编码</label>
                            <span class="weui-form-preview__value"> {{item.SCRW_CPBH }}</span>
                        </div>
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">产品名称</label>
                            <span class="weui-form-preview__value"> {{item.SCRW_NAME }}</span>
                        </div>
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">产品规格</label>
                            <span class="weui-form-preview__value">{{item.SCRW_CPGG }}</span>
                        </div>
                        <div class="weui-form-preview__item">
                            <label class="weui-form-preview__label">任务数量</label>
                            <span class="weui-form-preview__value"> {{item.SCRW_PCSL}}</span>
                        </div>
                        <div class="weui-flex sub_btn">
                            <input class="radio_input" type="button" name="inputs" value="选择"
                                @click="ProductName(item)" />
                        </div>
                    </div>
                    <div style="height:45px"></div>
                </div>
                <div class="task_btn">
                    <button id="close" class="btn btn-warning " @click="hiddenShow">关闭</button>
                </div>
            </div>
        </div>
    </div>
</body>
<script src="/JG/Content/jquery/jquery-3.2.1.min.js"></script>
<script src="/JG/Content/jquery/jquery-weui/js/jquery-weui.min.js"></script>
<script src="/JG/Content/vue-v2.34.js"></script>
<!-- <script type="text/javascript" src="/JG/Content/Flip-over.js?v=1"></script> -->
<script src="/JG/Content/Common.js"></script>

<script type="text/javascript">
    //赋值滚动条
    window.onload = function () {
        var BodyWidth = $(window).width();
        if (BodyWidth > 1281) {
            var BodyHeight = $(window).height();
            var MainPageHeight = BodyHeight - 90;
            //赋值给div
            $("#MainPage").height(MainPageHeight);
        } else if (BodyWidth < 1281 && BodyWidth > 1023) {
            var BodyHeight = $(window).height();
            var MainPageHeight = BodyHeight - 90;
            //赋值给div
            $("#MainPage").height(MainPageHeight);
        } else if (BodyWidth < 1024 && BodyWidth > 767) {
            var BodyHeight = $(window).height();
            var MainPageHeight = BodyHeight - 90;
            //赋值给div
            $("#MainPage").height(MainPageHeight);
        } else {
            var BodyHeight = $(window).height();
            var MainPageHeight = BodyHeight - 70;
            //赋值给div
            $("#MainPage").height(MainPageHeight);
        }
    }
</script>
<script type="text/javascript">
    var vmPage = new Vue({
        el: "#MainPage",
        data: {
            CarRoomName: '',            //车间名称
            CarRoomCode: "",            //车间编码
            ProductionLineData: [],     //产线集合
            StationData: [],            //工位集合
            ProductionLineCode: "",     //产线编码
            ProductionLineName: "",     //登录时得产线名称
            ProductLineId: "",          //产线ID
            ProductLineName: "",        //产线名称
            StationCode: "",            //工位号
            StationNames: "",           //工位名称
            StationName: "",            //登陆时的工位名
            TaskCode: "",                //任务单号
            WorkNumberData: [],         //工单号码集合
            submitData: '',             // 工单号返回
            OrderCode: '',              //订单号码
            ProcessCode: '',            //流程号码
            submitProduct: '',          //产品名返回
            ProductCode: '',            //产品编号
            ProductSize: "",             //产品规格
            ProductProcess: [],         //工序集合
            ProductProcessName: "",     //工序名称
            ProductProcessCode: "",     //工序编码
            CheckData: [],              //检测项集合
            FormData: {
                ProdLine: "",           //当前登录产线名称
                InvStd: "",             //当前登录的工位
            },
            curDate: "",                //产线时间
            show: false,                //弹窗初始状态
            show1: false,               //合格弹窗初始状态
            show2: false,               //不合格弹窗初始状态
            gdNumber: false,            //关闭工单号码弹窗状态 
            QualifiedCheck: '',          //合格实检输入框数量只能正整数的判断
            Qualified: '',               //合格输入框数量只能正整数的判断
            UnqualifiedCheck: '',        //不合格实检输入框数量只能正整数的判断
            Unqualified: '',             //不合格输入框数量只能正整数的判断                              
            Qualifiedremark: '',         //合格的备注
            Unqualifiedremark: '',       //不合格的备注
            QualifiedBtn: '合格',         //合格按钮
            UnqualifiedBtn: '不合格',     //不合格按钮
            checkIndexs: [],             //选中的检测项集合  
            SelectItemCode: [],          //选中的检测项编码集合  
            CheckRecord: [],             //确认后记录的检测项列表
            QualifiedremarkNum: "",
            UnqualifiedremarkNum: "",
            QuantityNum: ""                //任务单数量
        },
        mounted: function () {
            var currSelf = this;
            currSelf.ProdLineMethod();
            currSelf.GetProductionLine();
            currSelf.GetCheckData();
        },
        computed: {
            QualifiedCheckNum: function () {
                return this.oldNum
            },
            QualifiedNum: function () {
                return this.oldNum
            },
            UnqualifiedCheckNum: function () {
                return this.oldNum
            },
            UnqualifiedNum: function () {
                return this.oldNum
            },
        },
        methods: {
            ///获取产线全部信息方法
            ProdLineMethod: function () {
                var currSelf = this;
                currSelf.FormData.ProdLine = LocalUserInfo.GetUserInfo().ProductionLineName;   //获取当前用户登陆绑定的产线
                currSelf.FormData.InvStd = LocalUserInfo.GetUserInfo().StationName;   //获取当前用户登陆绑定工位
            },
            //获取产线、工位信息
            GetProductionLine: function () {
                var currSelf = this;
                $.ajax({
                    type: "post",
                    async: true,
                    url: LocalConfig.SrvPath + "/jgmes/commonAction!getCxGwList.action",
                    data: { phone: '1' },
                    dataType: "json",
                    success: function (ret) {
                        var retData = ret;
                        if (retData.IsSuccess) {
                            currSelf.ProductionLineData = retData.Data;
                        } else {
                            $.toptip(ret.message, "error");
                        }
                    }, error: function (xhr, status, err) {
                        $.toptip("请求发生异常错误", "error");
                    },
                    complete: function () {
                        $.hideLoading();
                    }
                });
            },
            //获取产线车间数据
            ProductionLineClick: function () {
                var currSelf = this;
                currSelf.checkIndexs = [];
                currSelf.StationData = [];
                currSelf.WorkNumberData = [];
                currSelf.submitData = "";
                currSelf.submitProduct = "";
                currSelf.ProductProcess = [];
                currSelf.OrderCode = "";
                currSelf.TaskCode = "";
                currSelf.ProductCode = "";
                currSelf.ProductSize = "";
                $.each(currSelf.ProductionLineData, function (index, item) {
                    if (currSelf.ProductionLineCode == item.CXSJ_CXBM) {
                        currSelf.ProductLineId = item.JGMES_BASE_CXSJ_ID
                        currSelf.ProductLineName = item.CXSJ_CXMC;
                        currSelf.CarRoomName = item.CXSJ_SZCJ;
                        currSelf.CarRoomCode = item.CXSJ_SZCJID;
                        currSelf.StationData = item.detail;
                    }
                });
            },
            //获取工位数据
            StationClick: function () {
                var currSelf = this;
                if (!currSelf.ProductLineName) {
                    $.toptip("需选择产线", "warning");
                } else {
                    $.each(currSelf.StationData, function (index, item) {
                        if (currSelf.StationCode == item.GW_GWBH) {
                            currSelf.StationNames = item.GW_GWMC;
                        }
                    });
                }

            },
            //获取工序名称
            ProductProcessClick: function () {
                var currSelf = this;
                $.each(currSelf.ProductProcess, function (index, item) {
                    if (currSelf.ProductProcessCode == item.GYLXGX_GXNUM) {
                        currSelf.ProductProcessName = item.GYLXGX_GXNAME;
                    }
                });


            },
            //获取工单号码
            GetWorkNumber: function () {
                var currSelf = this;

                currSelf.WorkNumberData = [];
                currSelf.gdNumber = true;
                if (!currSelf.ProductionLineCode) {
                    $.toptip("产线不能为空，请选择", "warning");
                    currSelf.gdNumber = false;
                } else if (currSelf.ProductionLineCode) {
                    $.ajax({
                        type: "post",
                        async: false,
                        url: LocalConfig.SrvPath + "/jgmes/commonAction!getScrw.action",
                        data: {
                            "mac": LocalUserInfo.GetUserInfo().Mac,
                            "userCode": LocalUserInfo.GetUserInfo().UserCode,
                            "cxCode": currSelf.ProductionLineCode,
                            "curDate": currSelf.curDate,
                            "zt": "RWZT01,RWZT02,RWZT04",
                        },
                        dataType: "json",
                        success: function (ret) {
                            var retData = ret;
                            if (retData.IsSuccess) {
                                currSelf.WorkNumberData = retData.Data;
                            } else if(!retData.Data){
                                $.toptip("该生产产线没有任务信息!", "warning");
                            }
                        },
                        error: function (xhr, status, err) {
                            // console.error(status);
                            $.toptip(status, "error");
                        },
                        complete: function () {
                            $.hideLoading();
                        }
                    })
                }
            },
            //点击弹窗选择按钮方法
            ProductName: function (items) {
                var currSelf = this;
                currSelf.ProductProcess = [];
                currSelf.ProductProcessCode = "";
                currSelf.submitData = items.SCRW_GDHM;
                currSelf.submitProduct = items.SCRW_NAME;
                currSelf.ProductCode = items.SCRW_CPBH;
                currSelf.OrderCode = items.SCRW_DDHM;
                currSelf.ProcessCode = items.SCRW_LCKH;
                currSelf.QuantityNum = items.SCRW_PCSL;
                currSelf.TaskCode = items.SCRW_RWDH;
                currSelf.ProductSize = items.SCRW_CPGG;
                //关闭工单号码弹窗
                currSelf.gdNumber = false;

                //根据产品获取工序列表接口               
                $.ajax({
                    type: "post",
                    async: false,
                    cache: true,
                    url: LocalConfig.SrvPath + "/jgmes/commonAction!getGXList.action",
                    data: {
                        "userCode": LocalUserInfo.GetUserInfo().UserCode,
                        "mac": LocalUserInfo.GetUserInfo().Mac,
                        "cpCode": currSelf.ProductCode,//产品编号
                    },
                    dataType: "json",
                    success: function (ret) {
                        if (ret.IsSuccess) {
                            currSelf.ProductProcess = ret.Data;
                        }else if(!ret.Data){
                            $.toptip("此任务单没有绑定工序!", "warning");
                        }
                    },
                    error: function (xhr, status, errorThrown) {
                        $.toptip(status, "error");
                    },
                    complete: function () {
                        $.hideLoading();
                    }
                });

            },
            //获取工序
            ProcessItem: function () {
                var currSelf = this;
                if (!currSelf.TaskCode) {
                    $.toptip("任务单号不能为空，请选择", "warning");
                }
            },
            //获取检测项
            GetCheckData: function () {
                var currSelf = this;
                $.ajax({
                    type: "post",
                    async: true,
                    url: LocalConfig.SrvPath + "/jgmes/jgmesXunJianAction!getJCX.action",
                    data: {},
                    dataType: "json",
                    success: function (ret) {
                        var retData = ret;
                        if (retData.IsSuccess) {
                            currSelf.CheckData = retData.Data;
                        } else {
                            $.toptip(ret.message, "error");
                        }
                    },
                    error: function (xhr, status, err) {
                        console.error(status);
                        $.toptip("请求发生异常错误", "error");
                    },
                    complete: function () {
                        $.hideLoading();
                    }
                })
            },
            //检测的多选
            changCheck: function (item) {
                if (this.checkIndexs.indexOf(item) == -1) {
                    this.checkIndexs.push(item);
                } else {
                    this.checkIndexs.splice(this.checkIndexs.indexOf(item), 1);
                }
            },
            //检测项的多选的判断选中项
            check: function (item) {
                return this.checkIndexs.some(function (num) {
                    return num == item;
                });
            },
            //合格点击按钮
            toggle1: function () {
                if (this.checkIndexs.length > 0 && this.ProductLineName && this.TaskCode) {
                    this.show = true;
                    this.show1 = true;
                } else if (!this.ProductLineName) {
                    $.toptip("产线不能为空，请选择！", "warning");
                } else if (!this.TaskCode) {
                    $.toptip("任务单号不能为空，请选择！", "warning");
                } else {
                    $.toptip("请至少选择一项检测项", "warning");
                }
            },
            //不合格点击按钮
            toggle2: function () {
                if (this.checkIndexs.length > 0 && this.ProductLineName && this.TaskCode) {
                    this.show = true;
                    this.show2 = true;
                } else if (!this.ProductLineName) {
                    $.toptip("产线不能为空，请选择！", "warning");
                } else if (!this.TaskCode) {
                    $.toptip("任务单号不能为空，请选择！", "warning");
                } else {
                    $.toptip("请至少选择一项检测项", "warning");
                }
            },
            cancel1: function () {
                this.show = false;
                this.show1 = false;
            },
            cancel2: function () {
                this.show = false;
                this.show2 = false;
            },
            confirm1: function () {
                var currSelf = this;
                //巡检表
                var jsonStr = JSON.stringify({
                    "XJB_CXID": currSelf.ProductLineId,     //产线ID
                    "XJB_CXMC": currSelf.ProductLineName,//产线名称
                    "XJB_CXBH": currSelf.ProductionLineCode,//产线编号
                    "XJB_GWMC": currSelf.StationNames,//工位名称
                    "XJB_GWBH": currSelf.StationCode,//工位编号
                    "XJB_GXBH": currSelf.ProductProcessCode,//工序编号
                    "XJB_GXMC": currSelf.ProductProcessName,//工序名称
                    "XJB_GDHM": currSelf.submitData,//工单号码
                    "XJB_DDHM": currSelf.OrderCode,//订单号码
                    "XJB_LCKH": currSelf.ProcessCode,//流程卡号
                    "XJB_CPBH": currSelf.ProductCode,//产品编号
                    "XJB_CPMC": currSelf.submitProduct,//产品名称
                    // "XJB_RQ":currSelf.ProductionLineCode,//日期
                    "XJB_CJMC": currSelf.CarRoomName,//车间名称
                    "XJB_CJBH": currSelf.CarRoomCode,//车间编号
                    // "XJB_XJDBH":currSelf.ProductionLineCode,//巡检单编号
                    // "XJB_XJSL":currSelf.ProductionLineCode,//巡检数量
                });
                //巡检字表
                var jsonStrDetail = [];
                for (var i in currSelf.checkIndexs) {
                    var element = currSelf.checkIndexs[i];
                    jsonStrDetail.push({
                        "XJBZB_JCXBH": element.JCXM_JCXBH,
                        "XJBZB_JCXMC": element.JCXM_JCXMC,
                        "XJBZB_HGSL": currSelf.Qualified,//合格数量
                        "XJBZB_BHGSL": currSelf.Unqualified,//不合格数量
                        "XJBZB_SJSL": currSelf.QualifiedCheck,//实检数量
                        "XJBZB_BZ": currSelf.Qualifiedremark,//备注
                        "XJBZB_SFHG_NAME": currSelf.QualifiedBtn,//是否合格名称
                    });
                }
                if (!this.QualifiedCheck) {
                    this.show = true;
                    this.show1 = true;
                    $.toptip("实检数量不能为空，请输入！", "warning");
                } else if (parseInt(this.QualifiedCheck) > parseInt(this.QuantityNum)) {
                    $.toptip("实检数量已超过任务单数量范围，请修改！", "warning");
                } else if (parseInt(this.Qualified) + parseInt(this.Unqualified) > parseInt(this.QualifiedCheck)) {
                    $.toptip("合格、不合格数量之和已超过实检数量范围，请修改！", "warning");
                }
                else if (parseInt(this.Qualified) > parseInt(this.QualifiedCheck)) {
                    $.toptip("合格数量已超过实检数量范围，请修改！", "warning");
                }
                else if (parseInt(this.Unqualified) > parseInt(this.QualifiedCheck)) {
                    $.toptip("不合格数量已超过实检数量范围，请修改！", "warning");
                }
                else if (!this.Qualified) {
                    this.show = true;
                    this.show1 = true;
                    $.toptip("合格数量不能为空，请输入！", "warning");
                } else if (parseInt(this.Unqualified) > parseInt(this.QualifiedCheck)) {
                    $.toptip("合格数量已超过实检数量范围，请修改！", "warning");
                }
                else {
                    this.show = false;
                    this.show1 = false;
                    $.toptip("数据提交成功", "success");
                    $.ajax({
                        type: "post",
                        async: true,
                        url: LocalConfig.SrvPath + "/jgmes/jgmesXunJianAction!doXunJianSave.action",
                        data: {
                            "userCode": LocalUserInfo.GetUserInfo().UserCode,
                            "jsonStrDetail": JSON.stringify(jsonStrDetail),
                            "jsonStr": jsonStr,
                        },
                        dataType: "json",
                        success: function (ret) {
                            var retData = ret;
                            if (retData.IsSuccess) {                              
                                $.each(jsonStrDetail, function (i, item) {
                                    var record = {
                                        CheckCode: item.XJBZB_JCXBH,
                                        CheckName: item.XJBZB_JCXMC,
                                        CheckStatu: item.XJBZB_SFHG_NAME,
                                        CheckTime: (new Date()).Format("hh:mm:sss"),
                                        Operator: LocalUserInfo.GetUserInfo().UserName,
                                    };
                                    currSelf.CheckRecord.splice(0, 0, record);
                                });

                            } else {
                                $.toptip(ret.message, "error");
                            }
                            currSelf.checkIndexs = [];
                            currSelf.ProductProcessCode = "";
                            currSelf.StationData = [];
                            currSelf.StationNames = "";
                            currSelf.Qualifiedremark = "";
                            currSelf.QualifiedCheck = "";
                            currSelf.Qualified = "";
                        },
                        error: function (xhr, status, err) {
                            console.error(status);
                            $.toptip("请求发生异常错误", "error");
                        },
                        complete: function () {
                            $.hideLoading();
                        }
                    })
                }
            },
            confirm2: function () {
                var currSelf = this;
                //巡检表
                var jsonStr = JSON.stringify({
                    "XJB_CXID": currSelf.ProductLineId,     //产线ID
                    "XJB_CXMC": currSelf.ProductLineName,//产线名称
                    "XJB_CXBH": currSelf.ProductionLineCode,//产线编号
                    "XJB_GWMC": currSelf.StationNames,//工位名称
                    "XJB_GWBH": currSelf.StationCode,//工位编号
                    "XJB_GXBH": currSelf.ProductProcessCode,//工序编号
                    "XJB_GXMC": currSelf.ProductProcessName,//工序名称
                    "XJB_GDHM": currSelf.submitData,//工单号码
                    "XJB_DDHM": currSelf.OrderCode,//订单号码
                    "XJB_LCKH": currSelf.ProcessCode,//流程卡号
                    "XJB_CPBH": currSelf.ProductCode,//产品编号
                    "XJB_CPMC": currSelf.submitProduct,//产品名称
                    // "XJB_RQ":currSelf.ProductionLineCode,//日期
                    "XJB_CJMC": currSelf.CarRoomName,//车间名称
                    "XJB_CJBH": currSelf.CarRoomCode,//车间编号
                    // "XJB_XJDBH":currSelf.ProductionLineCode,//巡检单编号
                    // "XJB_XJSL":currSelf.ProductionLineCode,//巡检数量
                });
                //巡检字表
                var jsonStrDetail = [];
                for (var i in currSelf.checkIndexs) {
                    var element = currSelf.checkIndexs[i];
                    jsonStrDetail.push({
                        "XJBZB_JCXBH": element.JCXM_JCXBH,
                        "XJBZB_JCXMC": element.JCXM_JCXMC,
                        "XJBZB_HGSL": currSelf.Qualified,//合格数量
                        "XJBZB_BHGSL": currSelf.Unqualified,// 不合格数量
                        "XJBZB_SJSL": currSelf.UnqualifiedCheck,//不合格实检数量
                        "XJBZB_BZ": currSelf.Unqualifiedremark,//备注
                        "XJBZB_SFHG_NAME": currSelf.UnqualifiedBtn,//是否合格名称
                    });
                }
                if (!this.UnqualifiedCheck) {
                    this.show = true;
                    this.show2 = true;
                    $.toptip("实检数量不能为空，请输入！", "warning");
                } else if (parseInt(this.UnqualifiedCheck) > parseInt(this.QuantityNum)) {
                    $.toptip("实检数量已超过任务单数量范围，请修改！", "warning");
                } else if (parseInt(this.Qualified) + parseInt(this.Unqualified) > parseInt(this.UnqualifiedCheck)) {
                    $.toptip("合格、不合格数量之和已超过实检数量范围，请修改！", "warning");
                }
                else if (parseInt(this.Qualified) > parseInt(this.QualifiedCheck)) {
                    $.toptip("合格数量已超过实检数量范围，请修改！", "warning");
                }
                else if (parseInt(this.Unqualified) > parseInt(this.UnqualifiedCheck)) {
                    $.toptip("不合格数量已超过实检数量范围，请修改！", "warning");
                }
                else if (parseInt(this.Qualified) > parseInt(this.UnqualifiedCheck)) {
                    $.toptip("合格数量已超过实检数量范围，请修改！", "warning");
                }
                else if (!this.Unqualified) {
                    this.show = true;
                    this.show2 = true;
                    $.toptip("不合格数量不能为空，请输入！", "warning");
                }
                else {
                    this.show = false;
                    this.show2 = false;
                    $.toptip("数据提交成功", "success");
                    $.ajax({
                        type: "post",
                        async: true,
                        url: LocalConfig.SrvPath + "/jgmes/jgmesXunJianAction!doXunJianSave.action",
                        data: {
                            "userCode": LocalUserInfo.GetUserInfo().UserCode,
                            "jsonStrDetail": JSON.stringify(jsonStrDetail),
                            "jsonStr": jsonStr,
                        },
                        dataType: "json",
                        success: function (ret) {
                            var retData = ret;
                            if (retData.IsSuccess) {
                                $.each(jsonStrDetail, function (i, item) {
                                    var record = {
                                        CheckCode: item.XJBZB_JCXBH,
                                        CheckName: item.XJBZB_JCXMC,
                                        CheckStatu: item.XJBZB_SFHG_NAME,
                                        CheckTime: (new Date()).Format("hh:mm:sss"),
                                        Operator: LocalUserInfo.GetUserInfo().UserName,
                                    };
                                    currSelf.CheckRecord.splice(0, 0, record);
                                });
                            } else {
                                $.toptip(ret.message, "error");
                            }
                            currSelf.checkIndexs = [];
                            currSelf.ProductProcessCode = "";
                            currSelf.StationData = [];
                            currSelf.StationNames = "";
                            currSelf.Unqualifiedremark = "";
                            // currSelf.submitData="";
                            // currSelf.submitProduct="";
                            currSelf.UnqualifiedCheck = "";
                            currSelf.Unqualified = "";
                        },
                        error: function (xhr, status, err) {
                            console.error(status);
                            $.toptip("请求发生异常错误", "error");
                        },
                        complete: function () {
                            $.hideLoading();
                        }
                    })
                }
            },
            close: function (index) {
                this.BadData.splice(index, 1)
            },
            //点击关闭工单号码弹窗
            hiddenShow: function () {
                this.gdNumber = false;
            },
            //合格实检数量的正则判断
            change1: function (event) {
                var val = event.target.value.trim()
                // 只能是正整数或空,可根据需求修改正则
                if (/^[1-9]\d*$|^$/.test(val)) {
                    this.QualifiedCheck = val
                } else {
                    event.target.value = this.QualifiedCheck
                }
            },
            //合格数量的正则判断
            change2: function (event) {
                var val = event.target.value.trim()
                // 只能是正整数或空,可根据需求修改正则
                if (/^[1-9]\d*$|^$/.test(val)) {
                    this.Qualified = val
                } else {
                    event.target.value = this.Qualified;
                }
            },
            //不合格实检数量的正则判断
            change3: function (event) {
                var val = event.target.value.trim()
                // 只能是正整数或空,可根据需求修改正则
                if (/^[1-9]\d*$|^$/.test(val)) {
                    this.UnqualifiedCheck = val
                } else {
                    event.target.value = this.UnqualifiedCheck
                }
            },
            //不合格数量的正则判断
            change4: function (event) {
                var val = event.target.value.trim()
                // 只能是正整数或空,可根据需求修改正则
                if (/^[1-9]\d*$|^$/.test(val)) {
                    this.Unqualified = val
                } else {
                    event.target.value = this.Unqualified
                }
            },
            //合格备注
            change5: function (event) {
                var val = event.target.value.trim()
                this.Qualifiedremark = val
            },
            //不合格备注
            change6: function (event) {
                var val = event.target.value.trim()
                this.Unqualifiedremark = val
            },
            wordopen: function () {
                this.gdNumber = true;
            }
        },
    });
</script>

</html>